package com.csii.file.config;

import com.csii.file.util.OssBootUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;

import javax.annotation.PostConstruct;

/**
 * @Description TODO
 * @Date 2020/11/21 9:30
 * @Created by Ian
 * @Contact: 19107614@qq.com
 */
@Slf4j
public class OssConfig {
    @Value(value = "${stdio.oss.endPoint}")
    private String endPoint;
    @Value(value = "${stdio.oss.accessKeyId}")
    private String accessKeyId;
    @Value(value = "${stdio.oss.accessKeySecret}")
    private String accessKeySecret;
    @Value(value = "${stdio.oss.bucketName}")
    private String bucketName;
    @Value(value = "${stdio.oss.staticDomain}")
    private String staticDomain;
    @PostConstruct
    public void initOss(){
        OssBootUtil.setAccessKeyId(accessKeyId);
        OssBootUtil.setAccessKeySecret(accessKeySecret);
        OssBootUtil.setBucketName(bucketName);
        OssBootUtil.setEndPoint(endPoint);
        OssBootUtil.setStaticDomain(staticDomain);
    }
}
